import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin:false,
    blog_id: '' || localStorage.blog_id,
    blog_id1:'',
    blog_id2:'',
    blog_id3:'',
    blog_id4:'',
    blog_id5:'',
    username:"测试用户",
    user_id:1,
    head_src:'https://i.postimg.cc/tgZNrkmn/image.jpg',
  },
  getters: {
  },
  mutations: {
    changeid(state,num){
      state.blog_id=num;
      localStorage.blog_id=num;
    },
    login (state, newName, newId, newUrl) {
      state.isLogin = true;
    },
    Logout (state) {
      state.isLogin = false;
      state.username = newName;
      state.user_id = newId;
      state.head_src = newUrl;
    }
  },
  actions: {
    change_id(context,num){
      context.commit('changeid',num);
    }
  },
  modules: {
  }
})
